//2009/07/31 13:06:16
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>

using namespace std;

class ThePriceIsRight
{
public:
	vector <int> howManyReveals(vector <int> prices)
	{
		int s[51], l[51];
		memset(s, 0, sizeof(s));
		memset(l, 0, sizeof(l)); //Don't forget the initialization;
		int number = 0;
		for(int i=0; i<prices.size(); i++)
		{
			int temp = 0;
			for(int k=0; k<i; k++)
			{
				if(prices[k] < prices[i])
					temp = max(temp, s[k]);// Find the greatest length to its left;
			}
			for(int k=0; k<i; k++)
			{
				if(s[k] == temp && prices[k] < prices[i])
					l[i] += l[k];// Count the ways.
			}
			l[i] = l[i] > 0 ? l[i]:1;
			s[i] = temp + 1;
			number = max(number, s[i]);
		}
		int ways = 0;
		for(int i=0; i<prices.size(); i++)
		{
			if(s[i] == number)
				ways += l[i];
		}
		vector<int> v; v.clear();
		v.push_back(number);
		v.push_back(ways);
		return v;
	}
};

